<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>图书查询</title>
    <link href="css/styles.css" rel="stylesheet" type="text/css"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>

<div class="wrapper">

    <div class="flexsearch">
        <div class="flexsearch--wrapper">
            <form class="flexsearch--form" action="/sql/query" method="post">
                <div class="flexsearch--input-wrapper">
                    <c:choose>
                        <c:when test="${message == null}">
                            <input class="flexsearch--input" name="bookName" type="text" placeholder="请输入书名">
                        </c:when>
                        <c:when test="${message != null}">
                            <input class="flexsearch--input" name="bookName"  type="text" placeholder="${message}">
                        </c:when>

                    </c:choose>
                </div>
                <input class="flexsearch--submit" type="submit" value="&#10140;"/>
            </form>
        </div>
    </div>

    <br/>
    <br/>
    <br/>
    <c:if test="${books != null}">
        <table class="bordered">
            <thead>
                <tr>
                    <th>编号</th>
                    <th>书名</th>
                    <th>作者</th>
                    <th>出版社</th>
                    <th>索书号</th>
                    <th>可借数量</th>
                </tr>
            </thead>
            <c:forEach items="${books}" var="bookInfo" varStatus="id">
                <tr>
                    <td><c:out value="${id.index+1}"/></td>
                    <td><a href="/sql/result/${bookInfo.book_name}"><c:out value="${bookInfo.book_name}"/></a></td>
                    <td><c:out value="${bookInfo.author}"/></td>
                    <td><c:out value="${bookInfo.press}"/></td>
                    <td><c:out value="${bookInfo.call_number}"/></td>
                    <td><c:out value="${bookInfo.sum}"/></td>
                </tr>
            </c:forEach>
        </table>
    </c:if>
</div>
<div class="copyright">
    ©<a href="mailto://553234736@qq.com">E-mail: 553234736@qq.com</a>
</div>
</body>
</html>
